#!/usr/bin/perl
require "pdcusrgroup-lib.pl";

&ReadParse();

&header($text{'index_title'}, "", "password", 0, 1);

print "<form name=pdcsetting action=index.cgi method=post onsubmit=\'return on_enter_submit(\"$text{'error_msg_nousername'}\");\'>";

print "<table class=mode1>";
print "<tr><td>$text{'ed_username'}</td>";
print "<td><input name=dm_username type=text class=text value=\"\"></td></tr>";

print "<tr><td>$text{'ed_password'}</td>";
print "<td><input name=dm_password type=password class=text value=\"\"></td></tr>";

print "</table>";

print "<table mode=1 cellspacing=10>";
print "<tr><td><input type=submit class=button1 name=storeandrefresh onclick=\'return on_submit_click_storeandrefresh(\"$text{'error_msg_nousername'}\");\' value=\"$text{'sb_submit'}\"></td>";
print "<td><input type=submit class=button1 name=sb_cancel onclick=\'return on_submit_click_cancel();\' value=\"$text{'sb_cancel'}\"></td></tr>";
print "</table>";

print "<input name=clickbutton type=hidden value=\"submit\">";

print "</form>";


print <<EOF;
<script>
function on_submit_click_storeandrefresh(error_msg)
{
	if(document.forms[0].dm_username.value == "")
	{
		alert(error_msg);
		return false;
	}
	document.forms[0].clickbutton.value="submit";
	document.forms[0].action = "storeandrefresh.cgi";
}

function on_enter_submit(error_msg)
{
        document.forms[0].storeandrefresh.disabled = true;
        document.forms[0].sb_cancel.disabled = true;
	if(document.forms[0].clickbutton.value == "cancel")
	{
		return on_submit_click_cancel();
	}
	return on_submit_click_storeandrefresh(error_msg);
}

function on_submit_click_cancel()
{
	document.forms[0].clickbutton.value="cancel";
	document.forms[0].action = "index.cgi";

}

</script>
EOF

&footer("/pdcusrgroup/", $text{'index'});
